package com.ykh.mybbsdemo.controller;

import com.ykh.mybbsdemo.service.TagService;
import com.ykh.mybbsdemo.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-08-30
 * Time: 15:46
 */
//最热标签模块
@RestController
@RequestMapping("tags")
public class TagsController {
    @Autowired
    private TagService tagService;

    @GetMapping("hot")
    public Result hot() {
        //查询最热的6个标签
        int limit = 6;
        return tagService.hots(limit);
    }

    //查询所有标签
    @GetMapping
    public Result findAll(){
        return tagService.findAll();
    }

    //查询所有标签(详细)
    @GetMapping("detail")
    public Result findAllDetail(){
        return tagService.findAllDetail();
    }

    @GetMapping("detail/{id}")
    public Result findDetailById(@PathVariable("id") Long id){
        return tagService.findDetailById(id);
    }


}
